from django import template
import string

register = template.Library()

@register.filter
def nextLetter(value):
    """
    Returns next letter in the alphabet

    Usage:
        {{ string|slice:"1"|nextLetter }}
    """
    
    if len(value) != 1:
        # Fail silently.
        return value
    
    # Make sure it's unicode
    value = unicode(value)
    value = value.lower()
    
    i = 0
    alphabet = string.lowercase
    for letter in alphabet:
        if letter == value and i!=25:
            i += 1
            return alphabet[i]
        i +=1
